$(function() {


	/**
	 *  调用购物车数据
	 */
    
	
		let  cl=   $(".cl");
        let  sum=0;  
		let t = cl.children().remove();		           	           
		$.get("gwcsel.do", function(data) {
		
			$.each(data, function(i, item) {
		   let  a="<span class=\"ajj\"><div class=\"ajj2\">"+item.foodCarName+"<span class=\"nu\">x"+item.foodCarNumber+"</span></div></span>";
           let b="<span class=\"ajj1\"><div class=\"xxz\">应付金额￥<span class=\"yin zongjia\">"+item.foodCarPriceCount+"</span></div><input type=\"hidden\" name=\"count\" value=\"\" class=\"co\"></span>";  

           sum=sum+Number(item.foodCarPriceCount);
            
           cl.append("<div class=\"sjj1\">"+a+b+"</div>")
			
			});
	      $(".zff").text("应付金额￥"+sum)
	      pric=sum;
		}, "json")
		
		
		/**
		 *  支付获取价格
		 */ 
/*	$("body").on("click",".l",function(){
		
	
		 let     price=Number($(".zff").text().substring(5))
	
	  		 $.get("zhifu.do",{id:price},function(data){
	  		
	  			location.href="certificate-zhifubao.do";		  			 				  			 
	  		 }				  				 
	  		  
	  		 ) 		  
	})*/
	
		  
		  //将购物车数据添加到结算界面
		    $("body").on("click",".l",function(){
		
		  	let arr = [];				    
		    	$(".sjj1").each(function(i,v){ 
		    		arr[i] = {foodOrderInfoPrice:$(this).find(".zongjia").text(),foodOrderInfoContent:$(".ajj2").text().substring(0,3)};
		    
		    		   console.info(JSON.stringify(arr));
		    	}); 
		    
	
		    	 var data = arr; 
		    
		  	 $.ajax({ 
		    		    type:"post",
		    		    url: "z.do", 
		    		    data:JSON.stringify(arr), 
		    		    dataType: "json", 
		    		    contentType:"application/json",//设置类型传入后台
		    		    success: function () {   
		    		         
		    		         	location.href="c.do";
		    		    } 
		    		  });  
		    		
		    	
		    	
		    })
		  

	
	 
	

})